feat(goto): add --ensure-auth flag for automated auth wall handling#65
Merged
feat(goto): add --ensure-auth flag for automated auth wall handling#65
Conversation
Register --ensure-auth in BOOLEAN_FLAGS and modify the goto auth wall detection block. When --ensure-auth is set, polls with checkAuthSuccess at 2s intervals instead of a static setTimeout checkpoint. On success, closes the headed browser, relaunches headless, and navigates to the original URL. On timeout or no display, returns ensureAuthCompleted: false with a descriptive message. The flag overrides --no-auth-wall-detect so auth detection runs even when wall detection is disabled.
Source-level assertions verify BOOLEAN_FLAGS registration, help text, opts.ensureAuth guard, checkAuthSuccess polling, result fields (ensureAuthCompleted true/false), timeout message, no-display path, guard condition override, headless relaunch, and poll interval. Flag parsing tests confirm boolean true parsing, no positional arg consumption, and compatibility with --timeout and --no-auth-wall-detect. CLI integration test runs goto with --ensure-auth against example.com.
Update SKILL.md goto section with flag description and return type, README.md action reference table and common flags table, commands/web-ctl.md quick reference, and CHANGELOG.md with new feature entry.
- Move sleep before checkAuthSuccess so first poll waits 2s - Add page.isClosed() check to prevent hung evaluations - Wrap checkAuthSuccess in try-catch for resilience during navigation - Remove unnecessary headless browser launch on timeout path - Guard closeBrowser with context null check on normal exit - Use url variable directly instead of redundant originalUrl
- Wrap headless relaunch in try-catch on success path to preserve auth completion context if reload fails - Wrap closeBrowser in try-catch on timeout path to ensure consistent context/page nullification even if browser already closed - Add source-level tests for new safety patterns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--ensure-authflag togotoaction that collapses the 3-round-trip auth pattern into a single commandcheckAuthSuccess)--ensure-authoverrides--no-auth-wall-detectwhen both are setpage.isClosed()checks, try-catch around polling and browser transitions, proper context nullification on timeoutTest Plan
npm test)npm run validatepasses--ensure-authagainst example.comgoto https://github.com/settings --ensure-authon a system with display - verify headed browser opens, auth completes, re-navigation returns settings pageCloses #35